import request from '@/config/axios'

// ERP基础资料-辅料物料 VO
export interface BaseAccessoryMaterialVO {
  id: string // id
  materialCode: string // 物料编号
  materialName: string // 物料名称
  materialSpecification: string // 物料规格
  model: string // 型号
  materialUnit: string // 物料单位
  remark: string // 备注
  materialType: string // 物料类型
  accountSubject: string // 科目
  stockWarning: boolean // 库存预警
  stockLowerLimit: number // 库存下限
  stockUpperLimit: number // 库存上限
  isApproved: boolean // 审核
  approver: string // 审核人
  approvalTime: Date // 审核时间
  accountingGroup: string // 会计组
  isReferenced: boolean // 是否引用
  volume: number // 体积
  unitWeight: number // 单重
  accountingVoucherCode: string // 会计凭证代码
}

// ERP基础资料-辅料物料 API
export const BaseAccessoryMaterialApi = {
  // 查询ERP基础资料-辅料物料分页
  getBaseAccessoryMaterialPage: async (params: any) => {
    return await request.get({ url: `/erp/base-accessory-material/page`, params })
  },

  // 查询ERP基础资料-辅料物料详情
  getBaseAccessoryMaterial: async (id: number) => {
    return await request.get({ url: `/erp/base-accessory-material/get?id=` + id })
  },

  // 新增ERP基础资料-辅料物料
  createBaseAccessoryMaterial: async (data: BaseAccessoryMaterialVO) => {
    return await request.post({ url: `/erp/base-accessory-material/create`, data })
  },

  // 修改ERP基础资料-辅料物料
  updateBaseAccessoryMaterial: async (data: BaseAccessoryMaterialVO) => {
    return await request.put({ url: `/erp/base-accessory-material/update`, data })
  },

  // 删除ERP基础资料-辅料物料
  deleteBaseAccessoryMaterial: async (id: number) => {
    return await request.delete({ url: `/erp/base-accessory-material/delete?id=` + id })
  },

  // 导出ERP基础资料-辅料物料 Excel
  exportBaseAccessoryMaterial: async (params) => {
    return await request.download({ url: `/erp/base-accessory-material/export-excel`, params })
  },

// ==================== 子表（ERP基础资料-辅料物料备注） ====================

  // 获得ERP基础资料-辅料物料备注分页
  getBaseAccessoryMaterialRemarkPage: async (params) => {
    return await request.get({ url: `/erp/base-accessory-material/base-accessory-material-remark/page`, params })
  },
  // 新增ERP基础资料-辅料物料备注
  createBaseAccessoryMaterialRemark: async (data) => {
    return await request.post({ url: `/erp/base-accessory-material/base-accessory-material-remark/create`, data })
  },

  // 修改ERP基础资料-辅料物料备注
  updateBaseAccessoryMaterialRemark: async (data) => {
    return await request.put({ url: `/erp/base-accessory-material/base-accessory-material-remark/update`, data })
  },

  // 删除ERP基础资料-辅料物料备注
  deleteBaseAccessoryMaterialRemark: async (id: number) => {
    return await request.delete({ url: `/erp/base-accessory-material/base-accessory-material-remark/delete?id=` + id })
  },

  // 获得ERP基础资料-辅料物料备注
  getBaseAccessoryMaterialRemark: async (id: number) => {
    return await request.get({ url: `/erp/base-accessory-material/base-accessory-material-remark/get?id=` + id })
  }
}